<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="t" tagdir="/WEB-INF/tags"%>
<t:template>
	    <jsp:attribute name="header" />
	    <jsp:attribute name="footer">Footer</jsp:attribute>
	    <jsp:body>
    
		<h3>Lista twoich konferencji</h3><br/>
		<a href="<c:url value="/conference/add.htm" />" class="btn btn-success " role="button">Utwórz konferencję</a>
		<br/>
		<br/>
		<div class="table-responsive">
		  <table class="table table-hover">
			<thead>
				<tr>
					<th>Data rozpoczęcia</th>
					<th>Temat</th>
					<th>Organizator</th>
					<th>Limit osobowy</th>
					<th>Akcja</th>
				</tr>
			</thead>
			<tbody>
			<c:forEach var="conference" items="${conferences}">
				<tr class='conferenceItemRow' id="${conference.id}">
					<td><fmt:formatDate pattern="dd-MM-YYYY" value="${conference.date}" /></td>
					<td>${conference.subject}</td>
					<td>${conference.author.firstname} ${conference.author.lastname}</td>
					<td style="padding-left:60px">${conference.personLimit}</td>
					<td style="padding-left:60px">
					<a href="<c:url value="/conference/edit/${conference.id}.htm" />" class="btn btn-warning" role="button">Edytuj</a> 
					<a href="<c:url value="/conference/delete/${conference.id}.htm" />" class="btn btn-danger" role="button">Usuń</a>
					</td>
				</tr>
			</c:forEach>
			</tbody>
	      </table>
	    </div>
		<h3>Lista konferencji w których bierzesz udział</h3>
		<div class="table-responsive">
		  <table class="table table-hover">
			<thead>
				<tr>
					<th>Data rozpoczęcia</th>
					<th>Temat</th>
					<th>Organizator</th>
					<th>Limit osobowy</th>
					<th>Akcja</th>
				</tr>
			</thead>
			<tbody>
			<c:forEach var="conference" items="${conferencesAsParticipant}">
				<tr class='conferenceItemRow' id="${conference.id}">
					<td><fmt:formatDate pattern="dd-MM-YYYY" value="${conference.date}" /></td>
					<td>${conference.subject}</td>
					<td>${conference.author.firstname} ${conference.author.lastname}</td>
					<td style="padding-left:60px">${conference.personLimit}</td>
					<td style="padding-left:60px">
					<a href="<c:url value="/conference/leave/${conference.id}.htm" />" class="btn btn-default" role="button">Wypisz się</a> 
					</td>
				</tr>
			</c:forEach>
			</tbody>
	      </table>
	    </div>
    </jsp:body>
</t:template>